using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableFieldDao:DaoBase<TableField>
    {
        public override void AddPrimaryIndex(TableField model)
        {
            cachePrimary[model.FieldId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableField.txt";
        }

        protected override TableField ParseRowData(string[] rowData)
        {
            TableField data = new TableField();
			data.FieldId = rowData [0];
			data.FieldMap = rowData [1];
			data.BattleMap = rowData [2];
			data.UI = rowData [3];
			data.Resurrection = rowData [4];
			data.SafeZone = rowData [5];
			data.FishPoints = rowData [6];
			data.MinePoints = rowData [7];
			data.MonsterPoints = rowData [8];

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.allSafe = 0;
            }
            else
            {
                data.allSafe = int.Parse(rowData[9]);
            }

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.levelLimit = 0;
            }
            else
            {
                data.levelLimit = int.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.FishGroupMax = 0;
            }
            else
            {
                data.FishGroupMax = int.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.MineMax = 0;
            }
            else
            {
                data.MineMax = int.Parse(rowData[12]);
            }
			data.bossPosIds = rowData [13];

            return data;
        }



    }

}
